#coding:utf8
from flask import Flask,render_template
import ConfigParser
 
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello():
	cf=ConfigParser.ConfigParser()
	cf.read('list.ini')
	lis_t=[]#临时数组
	lis=[] #传给模版的二元数组
	for nl in cf.sections():
		lis_t.append(cf.get(nl,'name'))
		lis_t.append(cf.get(nl,'iurl'))
		lis.append(lis_t)
		lis_t=[]
	return render_template('index_new.html',blis=lis)
	
@app.route('/view/<pagename>')
def view(pagename):
	page='xiaoshuo/'+pagename+'.txt'
	with open(page,'r') as fls:
		string=fls.readlines()
	return render_template('view.html',title=pagename,text=string)

from bae.core.wsgi import WSGIApplication
application = WSGIApplication(app)
